<template>
	<div>
	
			
		<el-row :gutter="24">
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">查询类型:</p>
			</el-col>
			<el-col :span="4">
				<el-select size="small" v-model="key" placeholder="选择查询方法">
					<el-option v-for="item in moduleCombo" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-col>
			<el-col :span="1" style="margin-right:10px;">
				<p class="queryLabel">查询内容:</p>
			</el-col>
			<el-col :span="4">
				<el-input size="small" v-model="value" placeholder="请输入查询内容">
				</el-input>
			</el-col>
			<el-col :span="12" style="padding-left: 0px;text-align: left">
				<el-button type="primary" size="small" v-on:click="conQueryList">查询</el-button> 
				<el-button type="primary" size="small" v-on:click="back">返回</el-button> 
			</el-col>
		</el-row>
		
		
		<div v-if="showCard == 1">
			
			
			<el-row>
				<el-col>
					<el-table :data="tableDataList.dataList" @row-dblclick="dbClick" stripe border>
						<el-table-column prop="plateNum" label="车牌号" width="180">
						</el-table-column>
	          			<el-table-column prop="vin" label="VIN" width="180">
						</el-table-column>
						<el-table-column prop="ownerName" label="车主" width="180">
						</el-table-column>
	          			<el-table-column prop="ownerTel" label="车主电话" width="180">
						</el-table-column>
						<el-table-column prop="series" label="车系" width="180">
						</el-table-column>
						
						<el-table-column prop="ownerAddress" label="车主住址" width="250">
						</el-table-column>
						<el-table-column  label="购买日期" width="180" :formatter="buyDateCov">
						</el-table-column>
					</el-table>
					<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total,prev, pager, next" :total="tableDataList.total">
					</el-pagination>
				</el-col>
			</el-row>
		</div>
		
		<div v-if="showCard == 2">
			<el-row :gutter="24" ><!--v-if="tableShow"-->
			<el-col :span="17">
				<el-row :gutter="24">
					<el-col :span="24">
						<div style="height: 1.5em;"></div>
					</el-col>
					<el-col :span="24">
						<div class="table-d">
							<el-collapse v-model="activeNamec">
								<el-collapse-item title="车辆档案" name="1">
									<el-row :gutter="24" style="text-align: right;padding-right: 30px;">
										<span v-for="item in tableData.CarTabel">
											<el-tag type="primary">
												{{item.label}}
											</el-tag>&nbsp;
										</span>

										<el-tag type="primary" v-if="tableData.CarInfo.dataList[0].marketTag != '' && tableData.CarInfo.dataList[0].marketTag != 'null' ">
											{{tableData.CarInfo.dataList[0].marketTag}}
										</el-tag>&nbsp;
										
										<el-tag type="success" v-if="tableData.CarInfo.dataList[0].cxTag != '' && tableData.CarInfo.dataList[0].cxTag != null ">
											{{tableData.CarInfo.dataList[0].cxTag}}
										</el-tag>&nbsp;
										
									</el-row>

									<el-row :gutter="24">
										<el-col :span="24">
											<div style="height: 0.5em;"></div>
										</el-col>
									</el-row>
									<table width="100%" border="0" cellspacing="1" cellpadding="10" style="color:rgb(103,106,108);font-size: 10px;">
										<tr>
											<td width="15" rowspan="8">
												<b>{{tableData.CarInfo.dataList[0].plateNum}}
													<el-tag type="primary">本公司</el-tag>
													<br /> {{tableData.CarInfo.dataList[0].seiries}}
													<br/> {{tableData.CarInfo.dataList[0].configure}}
													<br/> 车辆年份：{{tableData.CarInfo.dataList[0].modelYear}}
													<br/> 颜色:{{tableData.CarInfo.dataList[0].color}}
													<br/>
													<el-button type="primary" size="small" v-on:click="changePlantNum">编辑</el-button>
												</b>
											</td>
											<td width="15">
												<b>VIN</b>
											</td>
											<td width="15">
												<b>发动机号</b>
											</td>
											<td width="15">
												<b>购车日期</b>
											</td>
											<td width="15">
												<b>销售顾问</b>
											</td>
										</tr>
										<tr>
											<td>{{tableData.CarInfo.dataList[0].vin}}</td>
											<td>{{tableData.CarInfo.dataList[0].engineNum}}</td>
											<td>{{buyDates}}</td>
											<td>{{tableData.CarInfo.dataList[0].saler}}</td>
										</tr>
										<tr>
											<td>
												<b>上牌日期</b>
											</td>
											<td>
												<b>保修开始日期</b>
											</td>
											<td>
												<b>第一次进场</b>
											</td>
											<td>
												<b>行驶里程</b>
											</td>
										</tr>
										<tr>
											<td>{{licenceDates}}</td>
											<td>{{guaranteeStartDates}}</td>
											<td>{{firstEnterDates}}</td>
											<td>{{tableData.CarInfo.dataList[0].runMile}}</td>
										</tr>
										<tr>
											<td>
												<b>最后行驶里程</b>
											</td>
											<td>
												<b>上次维修日期</b>
											</td>
											<td>
												<b>下次保养日期</b>
											</td>
											<td>
												<b>下次保养里程</b>
											</td>
										</tr>
										<tr>
											<td>{{tableData.CarInfo.dataList[0].runMile}}</td>
											<td>{{lastMaintainDates}}</td>
											<td>{{nextMaintainDate}}</td>
											<td>{{tableData.CarInfo.dataList[0].nextMaintainMile}}</td>
										</tr>
										<tr>
											<td>
												<b>客服专员</b>
											</td>
											<td>
												<b>SA顾问</b>
											</td>
											<td>
												<b>保险专员</b>
											</td>

											<td>
												<b>维系人</b>
											</td>
										</tr>
										<tr>
											<td>{{tableData.CarInfo.dataList[0].saName}}</td>
											<td>{{tableData.CarInfo.dataList[0].kfName}}</td>
											<td>{{tableData.CarInfo.dataList[0].bxName}}</td>
											<td>{{tableData.CarInfo.dataList[0].wxId}}</td>
										</tr>
									</table>
								</el-collapse-item>
							</el-collapse>
						</div>
					</el-col>
					<el-col :span="24">
						<div style="height: 1.5em;"></div>
					</el-col>
					<el-col :span="24">
						<div class="table-d">
							<el-collapse v-model="activeNamecc">
								<el-collapse-item title="客户资料" name="1">
									<table width="100%" border="0" cellspacing="1" cellpadding="10" style="color:rgb(103,106,108);font-size: 10px;">
										<tr>
											<td width="15" colspan="3">
												<b>车主信息 {{tableData.CarInfo.dataList[0].ownerName}} {{tableData.CarInfo.dataList[0].senderGender}}[{{tableData.CarInfo.dataList[0].ownerProperty}}用车] [编码：{{tableData.CarInfo.dataList[0].ownerCode}}]</b>
												<el-button type="primary" size="small" v-on:click="changeSender" style="float: right;">修改资料</el-button>
											</td>

										</tr>
										<tr>
											<td>
												<b>车主资料</b>
											</td>
											<td>
												<b>联系人:{{tableData.CarInfo.dataList[0].ownerName}} {{tableData.CarInfo.dataList[0].senderGender}}</b>
											</td>
											<td>
												<b>送修人：{{tableData.CarInfo.dataList[0].manitainSender}} {{tableData.CarInfo.dataList[0].senderGender}}</b>
											</td>
										</tr>
										<tr>
											<td>出生日期：{{tableData.CarInfo.dataList[0].ownerBirthday}}
												<br />联系方式：
												<el-tag type="primary">{{tableData.CarInfo.dataList[0].ownerTel}}</el-tag>
												<br />地址：{{tableData.CarInfo.dataList[0].ownerAddress}}
												<br />所在行业：{{tableData.CarInfo.dataList[0].ownerTrader}} 家庭月收入：{{tableData.CarInfo.dataList[0].ownerMonthIncome}} 婚姻状况：{{tableData.CarInfo.dataList[0].ownerMarry}} 学历：{{tableData.CarInfo.dataList[0].ownerEducation}}
											</td>
											<td>联系方式：
												<el-tag type="primary">{{tableData.CarInfo.dataList[0].contactTel}}</el-tag>
												<br />联系人地址：{{tableData.CarInfo.dataList[0].contactAddress}}</td>
											<td>联系方式：
												<br/>
												<el-tag type="primary">{{tableData.CarInfo.dataList[0].senderTel}}</el-tag>

											</td>
										</tr>
										<tr>
											<td colspan="3">
												<b>用户标签:
													<span v-for="item in tableData.CustomerTabel">
														<el-tag type="primary">
															{{item.label}}
														</el-tag>&nbsp;
													</span>
												</b>
											</td>
										</tr>
									</table>
								</el-collapse-item>
							</el-collapse>
						</div>
					</el-col>
					<el-col :span="24">
						<div style="height: 1.5em;"></div>
					</el-col>
					<el-col :span="24">
						<div class="table-d">
							<el-collapse v-model="activeNames">
								<el-collapse-item title="售后工单" name="1">
									<el-tag type="success">售后总产值:￥{{tableData.WorkOrderProperty.sum}}</el-tag>
									<el-tag type="success">一年内产值:￥{{tableData.WorkOrderProperty.sumOfYear}}</el-tag>
									<el-tag type="success">总进场次数:{{tableData.WorkOrderProperty.totalIn}}次</el-tag>
									<el-tag type="success">一年内进场次数:{{tableData.WorkOrderProperty.totalInYear}}次</el-tag>
									<el-tag type="warning">首次进厂时间:{{countTime(tableData.WorkOrderProperty.firstEnterDate)}}</el-tag>
									<el-row :gutter="24">
										<el-col :span="24">
											<div style="height: 0.5em;"></div>
										</el-col>
									</el-row>
									<el-table :data="tableData.CarAfterSale.dataList" style="width: 100%" height="250" @row-click="orderClick">
										<el-table-column type="expand">
											<template scope="props">
												<el-form label-position="left" inline>
													<el-form-item label="收款金额">
														<span>{{ props.row.receiveAmount }}</span>
													</el-form-item>
													<el-form-item label="工单类别">
														<span>{{ props.row.type }}</span>
													</el-form-item>
													<el-form-item label="出厂里程">
														<span>{{ props.row.runMile }}</span>
													</el-form-item>
													<el-form-item label="竣工日期">
														<span>{{ countTime(props.row.finishDate) }}</span>
													</el-form-item>
													<el-form-item label="工单号">
														<span>{{ props.row.orderNum }}</span>
													</el-form-item>
													<el-form-item label="接待">
														<span>{{ props.row.receptor }}</span>
													</el-form-item>
													<el-form-item label="维修金额">
														<span>{{ props.row.maintainAmount }}</span>
													</el-form-item>
													<el-form-item label="开单日期">
														<span>{{countTime(props.row.openDate) }}</span>
													</el-form-item>
													<el-form-item label="预计交车时间">
														<span>{{countTime(props.row.expectDate) }}</span>
													</el-form-item>
													<el-form-item label="索赔单号">
														<span>{{ props.row.demandNum }}</span>
													</el-form-item>
													<el-form-item label="结算日期">
														<span>{{countTime(props.row.balanceDate)}}</span>
													</el-form-item>
													<el-form-item label="交车日期">
														<span>{{countTime(props.row.sendCarDate) }}</span>
													</el-form-item>
													<el-form-item label="结清日期">
														<span>{{countTime(props.row.clearDate) }}</span>
													</el-form-item>
													<el-form-item label="车牌号">
														<span>{{ props.row.plateNum }}</span>
													</el-form-item>
													<el-form-item label="送修人">
														<span>{{ props.row.sender }}</span>
													</el-form-item>
													<el-form-item label="维修类别">
														<span>{{ props.row.wxType }}</span>
													</el-form-item>
													<el-form-item label="状态">
														<span>{{ props.row.status }}</span>
													</el-form-item>
												</el-form>
											</template>
										</el-table-column>
										<el-table-column label="结算日期" prop="balanceDate" width="130px" :formatter="openDates">
										</el-table-column>
										<el-table-column label="工单号" width="170px" prop="orderNum">
										</el-table-column>
										<el-table-column label="维修类别" width="130px" prop="wxType">
										</el-table-column>
										<el-table-column label="产值" width="130px" prop="realAmount">
										</el-table-column>
										<el-table-column label="出厂里程" width="130px" prop="runMile">
										</el-table-column>
									</el-table>
								</el-collapse-item>
							</el-collapse>
						</div>
					</el-col>
					<el-col :span="24">
						<div style="height: 1.5em;"></div>
					</el-col>
					<el-col :span="24">
						<!--维修工单的项目-->
						<div class="table-d">
							<el-collapse v-model="activeNamei">
								<el-collapse-item title="维修项目" name="1">
									<el-table :data="tableDataOrder.dataList" stripe border height="250">
										<el-table-column prop="orderType" width="130px" label="工单类别">
										</el-table-column>
										<el-table-column prop="maintainType" width="130px" label="维修类别">
										</el-table-column>
										<el-table-column prop="itemName" width="220px" label="项目名称">
										</el-table-column>
										<el-table-column prop="worker" width="130px" label="技师">
										</el-table-column>
										<el-table-column prop="workKind" width="130px" label="工种">
										</el-table-column>
									</el-table>
								</el-collapse-item>
							</el-collapse>
						</div>
					</el-col>
					<el-col :span="24">
						<div style="height: 1.5em;"></div>
					</el-col>
					<el-col :span="24">
						<div class="table-d">
							<el-collapse v-model="activeName">
								<el-collapse-item title="延保记录" name="1">
									<el-table :data="tableData.exTable" stripe border height="250">
										<el-table-column prop="restartInsurance" label="合同开始" :formatter="startDates">
										</el-table-column>
										<el-table-column prop="restopInsurance" label="合同结束" :formatter="stopDates">
										</el-table-column>
										<el-table-column prop="typeName" label="延保类型">
										</el-table-column>
										<el-table-column prop="startLegend" label="开始里程">
										</el-table-column>
										<el-table-column prop="stopLegend" label="截止里程">
										</el-table-column>
									</el-table>
									<!--<table width="100%" border="0" cellspacing="1" cellpadding="10" style="color:rgb(103,106,108);font-size: 10px;">
																																				<tr>
																																					<td width="15"><b>合同开始</b></td>
																																					<td width="15"><b>合同结束</b></td>
																																					<td width="15"><b>延保类型</b></td>
																																					<td width="15"><b>开始里程</b></td>
																																					<td width="15"><b>截止里程</b></td>
																																				</tr>
																																				<tr>
																																					<td>{{countTime(tableData.CarInfo.dataList[0].restartInsurance)}}</td>
																																					<td>{{countTime(tableData.CarInfo.dataList[0].restopInsurance)}}</td>
																																					<td>{{tableData.CarInfo.dataList[0].typeName}}</td>
																																					<td>{{tableData.CarInfo.dataList[0].startLegend}}</td>
																																					<td>{{tableData.CarInfo.dataList[0].stopLegend}}</td>
																																				</tr>
																																			</table>-->
								</el-collapse-item>
							</el-collapse>
						</div>
					</el-col>
					<el-col :span="24">
						<div style="height: 1.5em;"></div>
					</el-col>
					<el-col :span="24">
						<div class="table-d">
							<el-collapse v-model="activeNamea">
								<el-collapse-item title="合同" name="1">
									<el-table :data="tableData.inTable" stripe border height="250">
										<el-table-column label="交强险">
											<el-table-column prop="compulsoryinsurancenum" label="合同号">
											</el-table-column>
											<el-table-column label="起止日期" :formatter="comDates">
											</el-table-column>
										</el-table-column>
										<el-table-column label="商业险">
											<el-table-column prop="commercialinsurancenum" label="合同号">
											</el-table-column>
											<el-table-column label="起止日期" :formatter="comDates">
											</el-table-column>
										</el-table-column>
										<el-table-column prop="baseType" label="类型">
										</el-table-column>
									</el-table>
									<!--<table width="100%" border="0" cellspacing="1" cellpadding="10" style="color:rgb(103,106,108);font-size: 10px;">
																																<tr>
																																	<td width="15" colspan="2"><b>交强险</b></td>
																																	<td width="15" colspan="2"><b>商业险</b></td>
																																	<td width="15" rowspan="2"><b>类型</b></td>
																																</tr>
																																<tr>
																																	<td width="10"><b>合同号</b></td>
																																	<td width="15"><b>起止日期</b></td>
																																	<td width="10"><b>合同号</b></td>
																																	<td width="15"><b>起止日期</b></td>
																																</tr>
																																<tr>
																																	<td>{{tableData.CarInfo.dataList[0].compulsoryinsurancenum}}</td>
																																	<td>{{countTime(tableData.CarInfo.dataList[0].compulsoryStartDate)}}</td>
																																	<td>{{tableData.CarInfo.dataList[0].commercialinsurancenum}}</td>
																																	<td>{{countTime(tableData.CarInfo.dataList[0].contractstartinsurance)}}</td>
																																	<td></td>
																																</tr>
																															</table>-->
								</el-collapse-item>
							</el-collapse>
						</div>
					</el-col>
				</el-row>
			</el-col>
			<el-col :span="7">
				<el-row :gutter="24">
					<el-col :span="24">
						<el-card class="box-cards" style="width:90%;overflow-y:scroll ;height: 600px;">
							<div slot="header">
								<span>维系记录</span>
								<!--<div v-if='this.$data.queryCompanyId == this.$data.curCompanyId'>-->
								<el-button type="danger" size="small" v-on:click="addConcat" icon="plus" style="float: right;">新增维护记录</el-button>
								<!--</div>-->
								<!--音频播放-->
								<!--<audio id="voiceId" controls="controls">
										<source id="voiceIdChild" src="">
									</audio>-->

							</div>
							<audio controls="controls" src="" id="recordPlayId" style="display:none"></audio>
							<el-row class="bborder" v-for="item in hisConcatGrid">

								<el-col :span="7" class="scolor">
									<img src="../../../../assets/phone.png" style="display:inline-block;float:right;" /> {{formatDate(Number(item.createTime),'YYYY-MM-DD')}}
									<br />
									<span cclass="fcolor" style="color: rgb(27,159,135);">{{formatDate(Number(item.createTime),'HH:mm:SS')}}</span>

									<el-button type="success" v-if="item.recordPatha !=''" @click='playVoice(item.recordPatha)'>
										有录音
									</el-button>
								</el-col>

								<el-col :span="17" class="pag" style="border-left:1px solid #D3DCE6;border-top:1px solid #D3DCE6;border-radius: 0;padding:8px 0px 5px 5px; ">
									<span class="ccolor">{{item.title}}
										<br /> 客户经理: &nbsp;{{item.uName}}</span>
									<br />
									<span class="concolor">&nbsp;{{item.content}}</span>
								</el-col>
							</el-row>
						</el-card>
					</el-col>
				</el-row>
			</el-col>
		</el-row>
		<!-- 维系记录窗口-->
		<concat :rowData="rowData" :show="rowDataShow" v-if="rowDataShow" v-on:refresh="refresh"></concat>
		<!--弹出框 结束-->
		<el-dialog title="变更车牌信息" v-model="plantNumFormShow">
			<el-form label-width="100px">
				<el-col :span="24">
					<el-form-item label="新车牌号:" required>
						<el-input size="small" placeholder="请输入车牌号" v-model="newPlantNum">
						</el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="savePlant">提 交</el-button>
			</div>
		</el-dialog>
		<el-dialog title="修改信息" v-model="senderFormShow">
			<el-form label-width="100px">

				<fieldset style="border-color: color: #D9D9D9;">
					<!--车主信息-->
					<legend>车主信息</legend>
					<el-col :span="24">
						<el-form-item label="姓名:" required>
							<el-input size="small" placeholder="请输入姓名" v-model="editOwnerSenderData.name">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="性别:" required>
							<el-select v-model="editOwnerSenderData.sex" size="small" placeholder="请选择性别">
								<el-option v-for="item in sexCombo" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="身份证:">
							<el-input size="small" placeholder="请输入身份证号" v-model="editOwnerSenderData.card">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="手机号码:" required>
							<el-input size="small" placeholder="请输入手机号码" v-model="editOwnerSenderData.phone">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="电话号码:">
							<el-input size="small" placeholder="请输入电话号码" v-model="editOwnerSenderData.tel">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="地址:">
							<el-input size="small" placeholder="请输入地址" v-model="editOwnerSenderData.addr">
							</el-input>
						</el-form-item>
					</el-col>

				</fieldset>
				<br><br>

				<!--送修人信息-->
				<fieldset>
					<legend>送修人信息</legend>
					<el-col :span="24">
						<el-form-item label="送修人姓名:" required>
							<el-input size="small" placeholder="请输入姓名" v-model="editOwnerSenderData.senderName">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="送修人性别:" required>
							<el-select v-model="editOwnerSenderData.senderSex" size="small" placeholder="请选择性别">
								<el-option v-for="item in sexCombo" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="送修人电话:" required>
							<el-input size="small" placeholder="请输入手机号码" v-model="editOwnerSenderData.senderPhone">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="联系人电话:" required>
							<el-input size="small" placeholder="请输入电话号码" v-model="editOwnerSenderData.contactTel">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="维系人:">
							<el-input size="small" placeholder="请输入维系人" v-model="editOwnerSenderData.wx_id">
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="销售顾问:">
							<el-input size="small" placeholder="请输入销售顾问" v-model="editOwnerSenderData.saler">
							</el-input>
						</el-form-item>
					</el-col>
				</fieldset>

			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="saveSender">提 交</el-button>
			</div>
		</el-dialog>

		<el-dialog title="请输入手机号" v-model="callFormShow" size="tiny">
			<el-form label-width="70px">
				<el-col :span="24">
					<el-form-item label="手机号:">
						<el-input size="small" placeholder="请输入手机号" v-model="telephoneInput">
						</el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="callInput" class="iconfont icon-dianhua"> 拨 打</el-button>
			</div>
		</el-dialog>
		<el-dialog title="查看客户信息" v-model="customShow" size="cus">
			<customer :qType="qType" :qValue="qValue" v-if="customShow"></customer>
		</el-dialog>
		<!--<el-dialog title="正在呼叫" v-model="callFormShow">
																													<div>正在呼叫电话：{{telephone}}</div>
																													<div slot="footer" class="dialog-footer">
																														<el-button type="primary" @click="savePlant">挂 机</el-button>
																													</div>
																												</el-dialog>-->

		</div>
		
		
	</div>
</template>
<script>
var audioPlay; // audio实例
var b = ""; //播放暂停控制
export default {
  computed: {
    //购车日期
    buyDates: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].buyDate == "" ||
        this.$data.tableData.CarInfo.dataList[0].buyDate == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].buyDate)
      ).format("YYYY-MM-DD");
    },
    //上牌日期
    licenceDates: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].licenceDate == "" ||
        this.$data.tableData.CarInfo.dataList[0].licenceDate == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].licenceDate)
      ).format("YYYY-MM-DD ");
    },
    //保修开始日期
    guaranteeStartDates: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].guaranteeStartDate == "" ||
        this.$data.tableData.CarInfo.dataList[0].guaranteeStartDate == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].guaranteeStartDate)
      ).format("YYYY-MM-DD ");
    },
    //第一次进场
    firstEnterDates: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].firstEnterDate == "" ||
        this.$data.tableData.CarInfo.dataList[0].firstEnterDate == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].firstEnterDate)
      ).format("YYYY-MM-DD ");
    },
    //上次维修日期
    lastMaintainDates: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].prevMaintainDate == "" ||
        this.$data.tableData.CarInfo.dataList[0].prevMaintainDate == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].prevMaintainDate)
      ).format("YYYY-MM-DD ");
    },
    //下次保养日期
    nextMaintainDate: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].nextMaintainDate == "" ||
        this.$data.tableData.CarInfo.dataList[0].nextMaintainDate == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].nextMaintainDate)
      ).format("YYYY-MM-DD ");
    },
    //车主生日
    ownerBirthdays: function() {
      if (
        this.$data.tableData.CarInfo.dataList[0].ownerBirthday == "" ||
        this.$data.tableData.CarInfo.dataList[0].ownerBirthday == null
      )
        return "";
      return this.moment(
        Number(this.$data.tableData.CarInfo.dataList[0].ownerBirthday)
      ).format("YYYY-MM-DD ");
    }
    /*---------------------------------------------------------------------------*/

    /*---------------------------------------------------------------------------*/
  },
  data: function() {
    return {
      queryArea: "",
      queryBrand: "",
      queryCompanyId: window.localStorage.getItem("companyId"),
      queryAreaCombo: [],
      queryBrandCombo: [],
      queryCompanyCombo: [],
      curCompanyId: window.localStorage.getItem("companyId"),
      
      tableDataList:{
      	dataList:[],
      	total:0
      },
      showCard:1,
      queryId:"",
      
      // 维系人
      stewardName: "",
      //车主、送修人信息修改数据
      editOwnerSenderData: {
        name: "",
        sex: "",
        card: "",
        tel: "",
        phone: "",
        addr: "",
        wx_id: "",
        saler: "",
        //送修人姓名
        senderName: "",
        //送修人性别
        senderSex: "",
        //送修人电话
        senderPhone: "",
        //联系人电话
        contactTel:""
      },
      getMethodId: "",
      rowData: {},
      rowDataShow: false,
      tagListsShow: false,
      qType: "",
      qValue: "",
      customShow: false,
      //手动拨号的手机号
      telephoneInput: "",
      /*---------------------------------------------------------------------------*/
      pickerOptions1: {
        shortcuts: [
          {
            text: "一天后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24);
              picker.$emit("pick", date);
            }
          },
          {
            text: "两天后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 2);
              picker.$emit("pick", date);
            }
          },
          {
            text: "三天后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 3);
              picker.$emit("pick", date);
            }
          },
          {
            text: "四天后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 4);
              picker.$emit("pick", date);
            }
          },
          {
            text: "一周后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
              picker.$emit("pick", date);
            }
          },
          {
            text: "两周后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 14);
              picker.$emit("pick", date);
            }
          },
          {
            text: "二十天后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 20);
              picker.$emit("pick", date);
            }
          },
          {
            text: "一个月后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 30);
              picker.$emit("pick", date);
            }
          },
          {
            text: "两月后",
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 60);
              picker.$emit("pick", date);
            }
          }
        ]
      },
      /*---------------------------------------------------------------------------*/
      //分组数据
      tableDataOrder: {
        total: 0,
        dataList: []
      },
      //classCombo
      /***********流失方向字典开始****************/
      //级联选择的值
      parentId: [],
      options: [
        {
          value: "zh",
          label: "综合",
          children: [
            {
              value: "srhf",
              label: "三日回访"
            }
          ]
        },
        {
          value: "by",
          label: "保养",
          children: [
            {
              value: "sb",
              label: "首保"
            },
            {
              value: "sbm",
              label: "目标月首保"
            },
            {
              value: "eb",
              label: "二保"
            },
            {
              value: "ebm",
              label: "目标月二保"
            },
            {
              value: "db",
              label: "定保"
            }
          ]
        },
        {
          value: "bx",
          label: "保险",
          children: [
            {
              value: "sc",
              label: "手册"
            },
            {
              value: "xbx",
              label: "新保续"
            },
            {
              value: "xubx",
              label: "续保续"
            },
            {
              value: "hy",
              label: "活跃"
            },
            {
              value: "fhy",
              label: "非活跃"
            }
          ]
        },
        {
          value: "ls",
          label: "流失",
          children: [
            {
              value: "zls",
              label: "准流失"
            },
            {
              value: "yls",
              label: "流失"
            }
          ]
        },
        {
          value: "ga",
          label: "关爱",
          children: [
            {
              value: "sr",
              label: "生日"
            },
            {
              value: "ns",
              label: "年审"
            },
            {
              value: "rc",
              label: "日常"
            },
            {
              value: "yb",
              label: "延保"
            },
            {
              value: "hd",
              label: "活动"
            }
          ]
        }
      ],
      missTargetCombo: [
        {
          value: "rt",
          label: "润通"
        },
        {
          value: "hf",
          label: "鸿发"
        },
        {
          value: "jh",
          label: "嘉恒"
        },
        {
          value: "yz",
          label: "银座"
        },
        {
          value: "xlc",
          label: "修理厂"
        },
        {
          value: "qt",
          label: "其它地区"
        }
      ],
      missReasonCombo: [
        {
          value: "fw",
          label: "服务原因"
        },
        {
          value: "je",
          label: "价格原因"
        },
        {
          value: "wxzl",
          label: "维修质量"
        },
        {
          value: "qt",
          label: "他店客户"
        },
        {
          value: "sg",
          label: "事故送修"
        },
        {
          value: "zr",
          label: "车辆转让"
        },
        {
          value: "wdyc",
          label: "外地用车"
        },
        {
          value: "czhc",
          label: "车主换车"
        },
        {
          value: "dwdd",
          label: "单位定点"
        },
        {
          value: "wdbyq",
          label: "未到保养期"
        }
      ],
      whPTypeCombo: [
        {
          value: "zh",
          label: "综合"
        },
        {
          value: "by",
          label: "保养"
        },
        {
          value: "bx",
          label: "保险"
        },
        {
          value: "ls",
          label: "流失"
        },
        {
          value: "ga",
          label: "关爱"
        }
      ],
      whCTypeCombo: [],
      form: {
        name: "",
        region: "",
        region1: "",

        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      //维系表单
      concatForm: {
        taskId: "", //任务 ID
        companyId: "",
        plateNum: "",
        vin: "",
        title: "", //维护主题
        parentId: "", //维系大类
        typeId: "", //维系小类
        //联系车主
        ownerName: "", //车主
        ownerPhone: "", //车主电话
        linkMan: "", //联系人
        linkMobile: "", //联系人手机号
        //
        maintainTime: null, //保养日期
        avgMaintainMile: "", //保养里程
        missReason: "",
        missTarget: "",
        concatFailReason: "",
        carId: "",
        content: "",
        //新建任务
        type: 1,
        expectDate: null,
        expectContent: "",
        //用户标签
        userTag: []
      },
      emptyConcatForm: {
        taskId: "", //任务 ID
        companyId: "", //分司ID
        plateNum: "", //车牌号
        vin: "", //车架号
        title: "", //维护主题
        carId: "",
        parentId: "", //维系大类
        typeId: "", //维系小类
        //联系车主
        ownerName: "", //车主
        ownerPhone: "", //车主电话
        linkMan: "", //联系人
        linkMobile: "", //联系人手机号
        maintainTime: null, //保养日期
        avgMaintainMile: "", //保养里程
        missReason: "",
        missTarget: "",
        concatFailReason: "",
        content: "",
        type: 1,
        //新建任务
        expectDate: null,
        expectContent: "",
        //用户标签
        userTag: []
      },
      taskName: "鲁A935CC车主，保险已过期！",
      concatShow: false,
      page: this.page,
      CurentPage: 0,
      //任务状态
      taskStatus: [
        {
          value: "0",
          label: "未延期"
        },
        {
          value: "1",
          label: "已延期"
        },
        {
          value: "2",
          label: "已完成"
        },
        {
          value: "3",
          label: "已关闭"
        },
        {
          value: "4",
          label: "未完成"
        }
      ],
      //任务状态
      taskPTypeCombo: [
        {
          value: "by",
          label: "保养"
        },
        {
          value: "bx",
          label: "保险"
        },
        {
          value: "ls",
          label: "流失"
        },
        {
          value: "ga",
          label: "关爱"
        },
        {
          value: "zdy",
          label: "自定义"
        }
      ],

      taskCTypeCombo: [],
      //任务状态
      bxChild: [
        {
          value: "cn",
          label: "次年"
        },
        {
          value: "xb",
          label: "续保"
        },
        {
          value: "hy",
          label: "活跃"
        },
        {
          value: "fhy",
          label: "非活跃"
        },
        {
          value: "bxjd",
          label: "保险接待"
        }
      ],
      gaChild: [
        {
          value: "sr",
          label: "生日"
        },
        {
          value: "ns",
          label: "年审"
        },
        {
          value: "zb",
          label: "质保"
        },
        {
          value: "yb",
          label: "延保"
        }
      ],

      lsChild: [
        {
          value: "6",
          label: "六个月"
        },
        {
          value: "7",
          label: "七个月"
        },
        {
          value: "8",
          label: "八个月"
        },
        {
          value: "9",
          label: "九个月"
        },
        {
          value: "10",
          label: "十个月"
        },
        {
          value: "11",
          label: "十一个月"
        },
        {
          value: "12",
          label: "十二个月"
        }
      ],

      //任务状态
      byChild: [
        {
          value: "sbt",
          label: "首保"
        },
        {
          value: "sbm",
          label: " 首保月"
        },
        {
          value: "ebt",
          label: "二保"
        },
        {
          value: "ebm",
          label: "二保月"
        },
        {
          value: "db",
          label: "定保"
        },
        {
          value: "dbm",
          label: "定保月"
        }
      ],
      //流失方向
      lostFX: [
        {
          value: "sbt",
          label: "润通"
        },
        {
          value: "sbm",
          label: " 鸿发"
        },
        {
          value: "ebt",
          label: "嘉恒"
        },
        {
          value: "ebm",
          label: "银座"
        },
        {
          value: "db",
          label: "修理厂"
        },
        {
          value: "dbm",
          label: "其他地区"
        }
      ],
      //流失原因
      lostYY: [
        {
          value: "sbt",
          label: "服务原因"
        },
        {
          value: "sbm",
          label: "价格原因"
        },
        {
          value: "ebt",
          label: "维修质量"
        },
        {
          value: "ebm",
          label: "他店客户"
        },
        {
          value: "db",
          label: "事故送修"
        },
        {
          value: "dbm",
          label: "车辆转让"
        },
        {
          value: "ebt",
          label: "外地用车"
        },
        {
          value: "ebm",
          label: "车主换车"
        },
        {
          value: "db",
          label: "单位定点"
        },
        {
          value: "dbm",
          label: "未到保养期"
        }
      ],
      //回访失败原因
      hfYY: [
        {
          value: "sbt",
          label: "错号"
        },
        {
          value: "sbm",
          label: "空号"
        },
        {
          value: "ebt",
          label: "停机"
        },
        {
          value: "ebm",
          label: "关机"
        },
        {
          value: "db",
          label: "拒访"
        },
        {
          value: "dbm",
          label: "无人接听"
        },
        {
          value: "ebt",
          label: "人员不符"
        },
        {
          value: "ebm",
          label: "员工车辆"
        }
      ],
      /*---------------------------------------------------------------------------*/

      /*---------------------------------------------------------------------------*/

      lsTargetCombo: [
        {
          value: "rt",
          label: "润通"
        },
        {
          value: "hf",
          label: "鸿发"
        },
        {
          value: "jh",
          label: "嘉恒"
        },
        {
          value: "yz",
          label: "银座"
        },
        {
          value: "xlc",
          label: "修理厂"
        },
        {
          value: "qt",
          label: "其它地区"
        }
      ],
      lsReasonCombo: [
        {
          value: "fw",
          label: "服务原因"
        },
        {
          value: "je",
          label: "价格原因"
        },
        {
          value: "wxzl",
          label: "维修质量"
        },
        {
          value: "qt",
          label: "他店客户"
        },
        {
          value: "sg",
          label: "事故送修"
        },
        {
          value: "zr",
          label: "车辆转让"
        },
        {
          value: "wdyc",
          label: "外地用车"
        },
        {
          value: "czhc",
          label: "车主换车"
        },
        {
          value: "dwdd",
          label: "单位定点"
        },
        {
          value: "wdbyq",
          label: "未到保养期"
        }
      ],
      userTagCombo: [],
      failReasonCombo: [
        {
          value: "ch",
          label: "错号"
        },
        {
          value: "kh",
          label: "空号"
        },
        {
          value: "tj",
          label: "停机"
        },
        {
          value: "gj",
          label: "关机"
        },
        {
          value: "jf",
          label: "拒访"
        },
        {
          value: "wrjt",
          label: "无人接听"
        },
        {
          value: "rybf",
          label: "人员不符"
        },
        {
          value: "ygcl",
          label: "员工车辆"
        }
      ],
      wxDialogTitle: "新增维护记录",

      //缩放属性
      activeNamec: ["1"],
      activeNamecc: ["1"],
      activeNames: ["1"],
      activeName: ["1"],
      activeNamei: ["1"],
      activeNamea: ["1"],
      //界面列表的显示属性
      tableShow: false,
      //送修人姓名
      senderName: "",
      //送修人性别
      senderSex: "",
      //送修人电话
      senderPhone: "",
      // 联系人电话
      contactTel:"",
      //新车牌号
      newPlantNum: "",
      senderFormShow: false,
      plantNumFormShow: false,
      FormShow: false,
      parentCombo: [
        {
          value: "zh",
          label: "综合"
        },
        {
          value: "by",
          label: "保养"
        },
        {
          value: "bx",
          label: "保险"
        },
        {
          value: "ls",
          label: "流失"
        },
        {
          value: "ga",
          label: "关爱"
        }
      ],
      typeCombo: [],
      zh: [
        {
          value: "srhf",
          label: "三日回访"
        }
      ],
      sexCombo: [
        {
          value: "男",
          label: "男"
        },
        {
          value: "女",
          label: "女"
        }
      ],
      by: [
        {
          value: "sb",
          label: "首保"
        },
        {
          value: "sby",
          label: "目标月首保"
        },
        {
          value: "eb",
          label: "二保"
        },
        {
          value: "eby",
          label: "目标月二保"
        },
        {
          value: "db",
          label: "定保"
        }
      ],
      whCTypeCombo: [],
      whZhChild: [
        {
          value: "srhf",
          label: "三日回访"
        }
      ],
      whByChild: [
        {
          value: "sb",
          label: "首保"
        },
        {
          value: "sbm",
          label: "目标月首保"
        },
        {
          value: "eb",
          label: "二保"
        },
        {
          value: "ebm",
          label: "目标月二保"
        },
        {
          value: "db",
          label: "定保"
        }
      ],
      whBxChild: [
        {
          value: "sc",
          label: "手册"
        },
        {
          value: "xbx",
          label: "新保续"
        },
        {
          value: "xubx",
          label: "续保续"
        },
        {
          value: "hy",
          label: "活跃"
        },
        {
          value: "fhy",
          label: "非活跃"
        }
      ],
      whLsChild: [
        {
          value: "zls",
          label: "准流失"
        },
        {
          value: "yls",
          label: "流失"
        }
      ],
      whGaChild: [
        {
          value: "sr",
          label: "生日"
        },
        {
          value: "ns",
          label: "年审"
        },
        {
          value: "rc",
          label: "日常"
        },
        {
          value: "yb",
          label: "延保"
        },
        {
          value: "hd",
          label: "活动"
        }
      ],
      bx: [
        {
          value: "sc",
          label: "手册"
        },
        {
          value: "xxb",
          label: "新续保"
        },
        {
          value: "xbx",
          label: "续保续"
        },
        {
          value: "bxhy",
          label: "活跃"
        },
        {
          value: "bxfhy",
          label: "非活跃"
        }
      ],
      ls: [
        {
          value: "zls",
          label: "准流失"
        },
        {
          value: "ls",
          label: "流失"
        }
      ],
      ga: [
        {
          value: "br",
          label: "生日"
        },
        {
          value: "ns",
          label: "年审"
        },
        {
          value: "ybt",
          label: "延保"
        },
        {
          value: "rc",
          label: "日常"
        },
        {
          value: "hd",
          label: "活动"
        }
      ],
      tableData: {
        CarInfo: {
          total: "",
          dataList: [
            {
              ownerMarry: "",
              color: "",
              concatGender: "",
              ownerCode: "",
              nextMaintainMile: "",
              ownerEducation: "",
              buyDate: "",
              typeName: "",
              saler: "",
              ownerTel: "",
              restartInsurance: "",
              contactTel: "",
              senderTel: "",
              restopInsurance: "",
              senderGender: "",
              guaranteeStartDate: "",
              ownerName: "",
              firstEnterDate: "",
              model: "",
              vin: "",
              contactAddress: "",
              compulsoryinsurancenum: "",
              brand: "",
              commercialinsurancenum: "",
              runMile: "",
              ownerBirthday: "",
              stopLegend: "",
              lastMaintainDate: "",
              contactName: "",
              engineNum: "",
              ownerGender: "",
              ownerMonthIncome: "",
              licenceDate: "",
              configure: "",
              ownerProperty: "",
              plateNum: "",
              modelYear: "",
              manitainSender: "",
              contractstartinsurance: "",
              compulsoryStartDate: "",
              startLegend: "",
              ownerAddress: "",
              ownerTrader: "",
              nextMaintainDate: "",
              maintainStartMile: ""
            }
          ]
        },
        CarAfterSale: {
          total: "",
          dataList: []
        },
        //用户标签
        CustomerTabel: [],
        CarTabel: [],
        exTable: [],
        inTable: [],
        WorkOrderProperty: {
          sum: "",
          sumOfYear: ""
        }
      },
      voiceURL: "",
      //历史维系表单
      hisConcatGrid: [],
      //页码数
      //CurentPage: 1,
      //每页的数量
      //page: this.page,
      //分组数据
      //tableData: {},
      //角色
      moduleCombo: [
        {
          label: "车牌号",
          value: "0"
        },
        {
          label: "VIN",
          value: "1"
        },
        {
          label: "车主姓名",
          value: "2"
        },
        {
          label: "车主手机号",
          value: "3"
        },
        {
          label: "送修人姓名",
          value: "4"
        },
        {
          label: "送修人手机号",
          value: "5"
        }
      ],
      key: "0",
      value: "",
      //页码数
      CurentPage: 1,
      //每页的数量
      page: this.page,
      
      //正在呼叫窗口
      callFormShow: false,
      //呼叫的电话
      //telephone:'',
      //最近的工单
      work: {
        workOrder: [],
        workItem: []
      }
    };
  },
  methods: {
    /*播放录音*/
    playVoice: function(recordPath) {
      debugger;
      if (recordPath == null || recordPath == "") {
        return;
      }
      audioPlay = document.getElementById("recordPlayId");
      audioPlay.style.display = "block";
      audioPlay.src = recordPath;
      audioPlay.play();
    },
    //
    onInputFileChange: function() {},
    //维系记录插件保存后的回调
    refresh: function() {
      this.conQuery();
    },
    childTag: function(tag) {
      this.$data.concatForm.userTag = tag;
      //	debugger;

      //	alert(tag[0]);
    },
    formatDate:function(val,form){
       return  this.moment(val).format(form);
    },
    //查看客户资料
    butClick: function() {
      debugger;
      this.$data.customShow = true;
      this.$data.qType = 1;
      this.$data.qValue = this.$data.tableData.CarInfo.dataList[0].vin;
    },
    //呼叫车主
    callOwner: function() {
      //alert(this.$data.tableData.CarInfo.dataList[0].ownerTel);
      debugger;
      this.call(this.$data.tableData.CarInfo.dataList[0].ownerTel);
    },
    //呼叫联系人
    callLink: function() {
      //alert("343");
      this.call(this.$data.concatForm.linkMobile);
    },
    //点击手动拨号
    inputForm: function() {
      this.$data.callFormShow = true;
      this.$data.telephoneInput = "";
    },
    //手动拨号
    callInput: function() {
      //alert("343");
      if (this.$data.telephoneInput == "") {
        this.$message.error("请输入要拨打的电话！");
      } else {
        this.call(this.$data.telephoneInput);
        this.$data.callFormShow = false;
      }
    },

    orderClick: function(row) {
      debugger;
      this.$http({
        method: "GET",
        url: this.API_ROOT + "/crm/workitem/page",
        params: {
          orderCode: row.orderNum,
          start: this.$data.CurentPage,
          limit: 20
        }
      }).then(
        function(resp) {
          //success
          resp.data.total = parseInt(resp.data.total);
          this.$data.tableDataOrder = resp.data;
        },
        function(error) {
          // error
        }
      );
    },

    /*************点开任务后，获取最近的工单**********/
    queryWork: function() {
      this.$http({
        method: "GET",
        url: this.API_ROOT + "/crm/workorder/work",
        params: {
          carId: this.$data.concatForm.carId
        }
      }).then(
        function(resp) {
          //success
          debugger;
          this.$data.work = resp.data;
        },
        function(error) {
          //error
        }
      );
    },

    countTime: function(val) {
      if (val == "" || val == null) return "";
      return this.moment(Number(val)).format("YYYY-MM-DD");
    },
    //保险开始时间
    startDates: function(row, column) {
      if (row.restartInsurance == "" || row.restartInsurance == null) return "";
      return this.moment(Number(row.restartInsurance)).format("YYYY-MM-DD");
    },
    //保险截止时间
    stopDates: function(row, column) {
      if (row.restopInsurance == "" || row.restopInsurance == null) return "";
      return this.moment(Number(row.restopInsurance)).format("YYYY-MM-DD");
    },
    //交强险起止时间
    comDates: function(row, column) {
      if (
        row.compulsoryStartDate == "" ||
        row.compulsoryStartDate == null ||
        row.compulsoryEndDate == "" ||
        row.compulsoryEndDate == null
      )
        return "";
      return (
        this.moment(Number(row.compulsoryStartDate)).format("YYYY-MM-DD") +
        "-" +
        this.moment(Number(row.compulsoryEndDate)).format("YYYY-MM-DD")
      );
    },
    //商业险起止时间
    conDates: function(row, column) {
      if (
        row.contractstartinsurance == "" ||
        row.contractstartinsurance == null ||
        row.contractstopinsurance == "" ||
        row.contractstopinsurance == null
      )
        return "";
      return (
        this.moment(Number(row.contractstartinsurance)).format("YYYY-MM-DD") +
        "-" +
        this.moment(Number(row.contractstopinsurance)).format("YYYY-MM-DD")
      );
    },
    //购车日期
    openDates: function(row, column) {
      if (row.balanceDate == "" || row.balanceDate == null) return "";
      return this.moment(Number(row.balanceDate)).format("YYYY-MM-DD");
    },
    // 购车日期转换
    buyDateCov: function(row, column) {
      if (row.buyDate == "" || row.buyDate == null) return "";
      return this.moment(Number(row.buyDate)).format("YYYY-MM-DD");
    },
    //修改车牌号
    changePlantNum: function() {
      this.$data.plantNumFormShow = true;
      this.$data.newPlantNum = this.$data.tableData.CarInfo.dataList[0].plateNum;
    },
    //修改送修人
    changeSender: function() {
      debugger;
      this.$data.senderFormShow = true;
      /*送修人信息*/
      this.$data.editOwnerSenderData.senderName = this.$data.tableData.CarInfo.dataList[0].manitainSender;
      this.$data.editOwnerSenderData.senderSex = this.$data.tableData.CarInfo.dataList[0].senderGender;
      this.$data.editOwnerSenderData.senderPhone = this.$data.tableData.CarInfo.dataList[0].senderTel;
      this.$data.editOwnerSenderData.contactTel = this.$data.tableData.CarInfo.dataList[0].contactTel; // 联系人手机

      /*车主信息*/
      this.$data.editOwnerSenderData.name = this.$data.tableData.CarInfo.dataList[0].ownerName;
      this.$data.editOwnerSenderData.sex = this.$data.tableData.CarInfo.dataList[0].ownerGender;
      this.$data.editOwnerSenderData.card = this.$data.tableData.CarInfo.dataList[0].ownerIdentity;
      this.$data.editOwnerSenderData.tel = this.$data.tableData.CarInfo.dataList[0].ownerPhone;
      this.$data.editOwnerSenderData.phone = this.$data.tableData.CarInfo.dataList[0].ownerTel;
      this.$data.editOwnerSenderData.addr = this.$data.tableData.CarInfo.dataList[0].ownerAddress;
      this.$data.editOwnerSenderData.saler = this.$data.tableData.CarInfo.dataList[0].saler;
      this.$data.editOwnerSenderData.wx_id = this.$data.tableData.CarInfo.dataList[0].wxId;
    },
    //保存新增车牌号
    savePlant: function() {
      debugger;
      if (!this.$data.newPlantNum == "") {
        this.$http({
          method: "GET",
          url: this.API_ROOT + "/crm/car/changePlate",
          params: {
            id: this.$data.tableData.CarInfo.dataList[0].id,
            plateNum: this.$data.newPlantNum
          }
        }).then(
          function(resp) {
            debugger;
            // es5写法
            this.$message(resp.data.msg);
            this.$data.plantNumFormShow = false;
            this.conQuery();
          },
          function(error) {
            // error
            this.$message.error(resp.data.msg);
          }
        );
      } else {
        this.$message.error("请填写车牌号！");
      }
    },

    //保存送修人信息
    saveSender: function() {
      debugger;

      this.$http
        .post(
          this.API_ROOT + "/crm/car/changeSender",
          this.$data.editOwnerSenderData,
          {
            params: {
              id: this.$data.tableData.CarInfo.dataList[0].id
              // name: this.$data.senderName,
              // sex: this.$data.senderSex,
              // phone: this.$data.senderPhone
            }
          }
        )
        .then(
          function(resp) {
            debugger;
            // es5写法
            this.$message(resp.data.msg);
            this.$data.senderFormShow = false;
            this.conQuery();
          },
          function(error) {
            // error
            this.$message.error(resp.data.msg);
          }
        );
    },
      //列表，分页大小切换
    handleSizeChange: function() {},
    //列表,当前页切换
    handleCurrentChange: function(currentPage) {
      this.$data.CurentPage = currentPage;
      //this.$data.dictGroup = '';
      this.baseQuery();
    },
    
    // 单人多车查询
    conQueryList:function () {
    	this.$data.showCard = 1;
    	debugger;
      if (this.$data.value == "" || this.$data.value == null) {
        this.$message("请输入查询内容");
      } else {
        this.$http({
          method: "GET",
          url: this.API_ROOT + "/crm/car/pageList", //url
          params: {
            page: this.$data.CurentPage,
            limit: this.page.pageSize,
            key: this.$data.key, //查询类别
            value: this.$data.value, //查询内容
            companyId: this.$data.queryCompanyId
          }
        }).then(
          function(resp) {
            debugger;
            // es5写法
            //判断是否返回了数据
            if (resp.data.success) {
              
				debugger;
            	this.$data.tableDataList.dataList = resp.data.dataList;
            	this.$data.tableDataList.total = Number(resp.data.total);
              debugger;
            } else {
            	this.$message("未查询到数据！");
              	this.$data.tableShow = false;
            }
          },
          function(error) {
            // error
            this.$message.error(resp.data.msg);
          }
        );
      }
    },
    
    // 表格项双击
    dbClick:function(row){
    	//alert(row.id);
    	this.$data.rowDataShow = false;
    	this.$data.showCard = 2;
    	this.$data.queryId = row.id;
    	this.conQuery();
    },
    back:function(){
    	this.$data.queryId = ""; // 返回列表时置空车辆id
    	this.$data.showCard = 1;
    },
    
    //查询
    conQuery: function() {
      //判断是否输入了查询条件
      debugger;
      if (this.$data.value == "" || this.$data.value == null) {
        this.$message("请输入查询内容");
      } else {
        this.$http({
          method: "GET",
          url: this.API_ROOT + "/crm/car/page",
          params: {
            //key: this.$data.key, //查询类别
            //value: this.$data.value, //查询内容
            id:this.$data.queryId,
            companyId: this.$data.queryCompanyId
          }
        }).then(
          function(resp) {
            debugger;
            // es5写法
            //判断是否返回了数据
            if (resp.data.msg != "查询成功！") {
              this.$message("未查询到数据！");
              this.$data.tableShow = false;

              debugger;
            } else {
              this.$data.tableDataOrder = {
                total: 0,
                dataList: []
              };
              this.$message(resp.data.msg);
              this.$data.tableData = resp.data;
              this.$data.getMethodId = resp.data.CarInfo.dataList[0].id;
              debugger;
              if (
                this.$data.tableData.WorkOrderProperty.sum != "" &&
                this.$data.tableData.WorkOrderProperty.sum != undefined
              ) {
                this.$data.tableData.WorkOrderProperty.sum = this.$data.tableData.WorkOrderProperty.sum.toFixed(
                  2
                );
              }

              if (
                this.$data.tableData.WorkOrderProperty.sumOfYear != "" &&
                this.$data.tableData.WorkOrderProperty.sumOfYear != undefined
              ) {
                this.$data.tableData.WorkOrderProperty.sumOfYear = this.$data.tableData.WorkOrderProperty.sumOfYear.toFixed(
                  2
                );
              }
              //						this.$data.tableData.CarAfterSale.dataList.realAmount = this.$data.tableData.CarAfterSale.dataList.realAmount.toFixed(2);
              if (this.$data.tableData.CarInfo != undefined) {
                this.queryConcatGrid();
                //修改内容显示属性
                this.$data.tableShow = true;
              }
            }
          },
          function(error) {
            // error
            this.$message.error(resp.data.msg);
          }
        );
      }
    },
    //列表，分页大小切换
    handleSizeChange: function() {},
    //列表,当前页切换
    handleCurrentChange: function(currentPage) {
      this.$data.CurentPage = currentPage;
      //this.$data.dictGroup = '';
      this.conQuery();
    },
    //新增维系记录
    addConcat: function() {
      debugger;
      this.$data.rowDataShow = false;
      this.$data.rowData = {};
      this.rowShow();
      //清空数据
      //				debugger;
      //				//this.$data.wxDialogTitle = data.content;
      //					this.$data.concatForm = Object.assign(this.$data.concatForm, this.$data.emptyConcatForm);
      //				var formDataPar = this.$data.tableData.CarInfo.dataList[0]
      //				this.$data.concatForm.linkMobile = formDataPar.senderTel;
      //				this.$data.concatForm.ownerName = formDataPar.ownerName;
      //
      //				this.$data.concatForm.linkMan = formDataPar.contactName;
      //				//this.$data.concatForm.linkMobile = formDataPar.ownerName;
      //				//this.$data.concatForm.ownerName = formDataPar.ownerName;
      //				this.$data.concatForm.ownerPhone = formDataPar.ownerTel;
      //				//this.$data.concatForm.taskId = formDataPar.ownerName;
      //				this.$data.concatForm.plateNum = formDataPar.plateNum;
      //				//this.$data.concatForm.userTag = [];
      //				this.$data.parentId = [];
      //				this.$data.concatForm.vin = formDataPar.vin;
      //				this.$data.concatForm.carId = formDataPar.id;
      //				this.queryWork();
      //				this.$data.concatShow = true;
      //				this.queryOwnerTag();
    },
    rowShow: function() {
      debugger;
      this.$data.rowData = this.$data.tableData.CarInfo.dataList[0];
      this.$data.rowDataShow = true;
      //this.conQuery();
    },
    //状态转换
    statusCov: function(row, column) {
      return row.status == "0" ? "已停用" : "已启用";
    },
    //查询用户标签下拉
    userTagCombos: function() {
      this.$http
        .get(this.API_ROOT + "/crm/car/carTable", {
          params: {
            group: "userTag"
          }
        })
        .then(
          response => {
            // success callback
            this.$data.userTagCombo = response.data;
          },
          response => {
            // error callback
          }
        );
    },
    /*************获取已有的维系记录列表**********/
    queryConcatGrid: function() {
      this.$http({
        method: "GET",
        url: this.API_ROOT + "/crm/contact/info",
        params: {
          //                      start: this.$data.CurentPage,
          //                      limit: this.$data.page.pageSize,
          plateNum: this.$data.tableData.CarInfo.dataList[0].plateNum,
          vin: this.$data.tableData.CarInfo.dataList[0].vin,
          companyId: this.$data.queryCompanyId
        }
      }).then(
        function(resp) {
          //success
          debugger;

          this.$data.hisConcatGrid = resp.data.dataList;
          audioPlay = document.getElementById("recordPlayId");
          audioPlay.style.display = "none";
          audioPlay.pause();
          audioPlay.src = "";
        },
        function(error) {
          //error
        }
      );
    },
    /*************************************************/
    /*********************完成任务*******************/
    saveConcat: function() {
      debugger;
      if (this.$data.concatForm.maintainTime) {
        this.$data.concatForm.maintainTime = new Date(
          this.$data.concatForm.maintainTime
        ).getTime();
      }
      if (this.$data.concatForm.expectDate) {
        this.$data.concatForm.expectDate = this.moment(
          this.$data.concatForm.expectDate
        ).format("YYYY-MM-DD");
      }

      this.$http({
        method: "POST",
        url: this.API_ROOT + "/crm/contact/save",
        body: this.$data.concatForm
      }).then(
        function(resp) {
          //this.queryTaskGrid();
          this.$data.concatShow = false;
          //调用页面刷新
          this.conQuery();
        },
        function(error) {
          // error
        }
      );
    },
    getQueryCompanyInfo: function() {
      //this.$data.data.companyId = ""; //清空单位
      this.$data.queryCompanyId = ""; //清空单位
      this.$data.queryCompanyCombo = [];
      debugger;
      this.$http
        .get(this.API_ROOT + "/rbac/dept/all", {
          params: {
            area: this.$data.queryArea,
            brand: this.$data.queryBrand
          }
        })
        .then(resp => {
          this.$data.queryCompanyCombo = resp.data.dataList;
          if (this.$data.queryCompanyCombo.length > 0) {
            this.$data.queryCompanyId = this.$data.queryCompanyCombo[0].id;
          }
        });
    },
    //获取区域
    getQueryArea: function() {
      debugger;
      this.$http
        .get(this.API_ROOT + "/rbac/dept/area/all", {
          params: {}
        })
        .then(resp => {
          this.$data.queryAreaCombo = resp.data.dataList;
        });
    },
    //获取品牌
    getQueryBrand: function() {
      debugger;
      this.$http
        .get(this.API_ROOT + "/rbac/dept/brand/all", {
          params: {}
        })
        .then(resp => {
          this.$data.queryBrandCombo = resp.data.dataList;
        });
    },

    changeQueryCompany: function() {
      debugger;
      //加载行政区划
      //改变人员
      //this.queryPeople();
    }
  },
  //表单创建时执行
  created: function() {
    this.$data.tableShow = false;
    this.userTagCombos();
    //获取区域，品牌，公司信息
    this.getQueryArea();
    this.getQueryBrand();
    this.getQueryCompanyInfo();
  }
};
</script>
<style>
.el-table .info-row {
  height: 10px !important;
}

.item {
  width: 30px;
}

.el-form-item {
  clear: both;
}

.el-dropdown .el-button-group,
.el-table .el-tooltip,
.el-table .el-tooltip__rel {
  display: inline;
}

.el-table {
  height: 100%;
  width: 100%;
}

.table-d table {
  background: rgb(231, 231, 231);
}

.table-d table td {
  background: #fff;
}

.box-cards {
  width: 360px;
  /* height: 350px; */
  margin-left: auto;
  margin-right: auto;
  margin-top: 10%;
}
</style>